package meconsea.life.buddy.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import meconsea.life.sys.entity.AbsEntity;

import org.hibernate.annotations.Type;

@SuppressWarnings("serial")
@Entity
@Table(name="BUDDY_EVENT")
@NamedQueries({
	@NamedQuery(name=BuddyEvent.BUDDY_EVENT_FIND_BYUSER,query="SELECT O FROM BuddyEvent O where O.userName=:userName"),
	@NamedQuery(name=BuddyEvent.BUDDY_EVENT_FIND_INUSER,query="SELECT O FROM BuddyEvent O where O.userName in (:usernames)")
})
public class BuddyEvent extends AbsEntity {
	public final static String BUDDY_EVENT_FIND_BYUSER = "buddy_event_find_byUser";
	public final static String BUDDY_EVENT_FIND_INUSER = "buddy_event_find_inUser";
	@Column(name="username",length=64)
	private String userName;
	
	@Column(name="role")
	@Type(type="integer")
	private Integer role;
	
	@Column(name="isonline")
	@Type(type="integer")
	private Integer isOnline;
	
	@Column(name="eventmsg",length=1024)
	private String eventMsg;
	
	@Override
	public String toString(){
		return "id="+getId()+";username="+getUserName();
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Integer getRole() {
		return role;
	}

	public void setRole(Integer role) {
		this.role = role;
	}

	public Integer getIsOnline() {
		return isOnline;
	}

	public void setIsOnline(Integer isOnline) {
		this.isOnline = isOnline;
	}

	public String getEventMsg() {
		return eventMsg;
	}

	public void setEventMsg(String eventMsg) {
		this.eventMsg = eventMsg;
	}
}
